local global = require "global"

local appname = APPNAME


local keysutils={}

function keysutils.get_zset_key(key,subkey)
    local key = string.format("%s:zset:%s:%s",appname,key,subkey)
    return key
end

-- 注册发送验证码
function keysutils.get_register_phone_code_key(phone)
    local key = string.format("%s:register:phone:code:%s", appname, tostring(phone))
    return key
end

-- 忘记密码发送验证码
function keysutils.get_forget_phone_code_key(phone)
    local key = string.format("%s:forget:phone:code:%s", appname, tostring(phone))
    return key
end

-- 绑定手机号发送验证码
function keysutils.get_bind_phone_code_key(phone)
    local key = string.format("%s:bind:phone:code:%s", appname, tostring(phone))
    return key
end

-- 用户数据
function keysutils.get_main_usermap_key(uid)
    local key = string.format("%s:usermap:%s", appname, tostring(uid))
    return key
end

-- 用户密码
function keysutils.get_user_pwd_key(phone)
    local key = string.format("%s:user:pwd:%s", appname, tostring(phone))
    return key
end

-- 用户唯一标识
function keysutils.get_main_user_key(phone)
    local key = string.format("%s:user:%s", appname, tostring(phone))
    return key
end

-- 用户refresh_token
function keysutils.get_refresh_token_key(token)
    local key = string.format("%s:refresh_token:%s", appname, tostring(token))
    return key
end

-- 用户实名信息
function keysutils.get_idcard_key(idcard)
    local key = string.format("%s:realname:idcard:%s", appname, tostring(idcard))
    return key
end




function keysutils.get_phone_code_key(phone)
    local key = string.format("%s:phone:code:%s", appname, tostring(phone))
    return key
end


function keysutils.get_user_phone_key(phone)
    local key = string.format("%s:user:phone:%s", appname, tostring(phone))
    return key
end


function keysutils.get_admin_token(id)
    local key = string.format("%s:admin:token:%s", appname, tostring(id))
    return key
end

function keysutils.get_user_token(uid)
    local key = string.format("%s:user:token:%s", appname, tostring(uid))
    return key
end

function keysutils.get_admin_user_token(uid)
    local key = string.format("%s:admin:user:token:%s", appname, tostring(uid))
    return key
end

function keysutils.get_user_key(uid)
    local key = string.format("%s:user:%s", appname, tostring(uid))
    return key
end

function keysutils.get_user_list_key()
    return string.format("%s:user:list", appname)
end

function keysutils.get_user_nickname(nickname)
    return string.format("%s:user:nickname:%s", nickname)
end

function keysutils.get_white_list_key()
    return string.format("%s:white:user:list", appname)
end

function keysutils.get_tudi_list_key(uid)
    return string.format("%s:tudi:list:%s", appname, tostring(uid))
end

return keysutils






















